#ifndef _UTILS_H
#define _UTILS_H

#include <stdint.h>
#include <stdbool.h>


void reverse_bytes(uint8_t* bytes, size_t size);

int read_file(char *filename, unsigned char *buffer, int len);

int write_file(char *filename, unsigned char *buffer, int len);

uint32_t  get_file_length(const char *filename);

bool  file_exist(const char *filename);

int vcpu_reset(void *buf, size_t buf_len,
               uint64_t model,
               uint32_t reset_addr, bool reset_data_valid);

void hex_dump(const uint8_t* addr, uint32_t len);

uint64_t build_vcpu_model(uint32_t family, uint32_t model, uint32_t stepping);
uint64_t get_vcpu_model_value(const char* name);
long str2int(char * str);
char* base64_encode(const unsigned char* data, size_t length);

#endif
